﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 飞机大战
{
    internal class Plane : Game
    {
        //飞机生命
        public int Life { get; set; }
        private bool b;
        public Plane(int x, int y, int width, int height, Image[] images, int speed, State state, int life) : base(x, y, width, height, images, speed, state)
        {
            this.Life = life;
        }
        //画飞机
        public override void Draw(Graphics g) 
        {
            switch(this.State)
            {
                case State.EnemyPlane:
                    this.Y += Speed;
                    break;
            }
            
            g.DrawImage(Images[0], this.X, this.Y, this.Width, this.Height);
        }

        public void DrawBoss(Graphics g, int formWidth)
        {
            if(this.X >= formWidth - Width)
            {
                b = true;
            }
            else if(this.X <= 0) 
            {
                b = false;
            }
            if(b)
            {
                this.X -= Speed;
            }
            else
            {
                this.X += Speed;
            }
            g.DrawImage(Images[0], this.X, this.Y, this.Width, this.Height);
        }
    }
}
